package enumdemo;

import util.Print;

/**
 * 枚举添加方法
 * @author hucha
 */
public class CustomFieldAndMethod {

	public static void main(String[] args) {
		for(FieldAndMethod s: FieldAndMethod.values()) {
			Print.print(s.name() + "|" + s.toString() + "|" + s.getDesc());
		}
	}
}
enum FieldAndMethod{
	METHOD1("我是描述方法"),
	METHOD2("我是xx方法")
	;

	private String desc;//枚举字段
	public String getDesc() {
		return this.desc;
	}
	private FieldAndMethod(String desc) {
		this.desc = desc;
	}

	@Override
	public String toString() {
		return this.desc;
	}
	
}
